Skip to content

Remove CPI v1 Support#2757

Open
aramprice wants to merge 2 commits into
mainfrom
remove-cpi-v1-testing
Open

Remove CPI v1 Support#2757
aramprice wants to merge 2 commits into
mainfrom
remove-cpi-v1-testing

Conversation

@aramprice

@aramprice aramprice commented Jun 27, 2026

Copy link
Copy Markdown
Member

CPI v1 has been deprecated for a long time, we should stop testing it.

=> https://bosh.ci.cloudfoundry.org/builds/365976656

in all but one ci task this was set to `false` already.
Copilot AI review requested due to automatic review settings June 27, 2026 00:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR updates CPI API handling to use version 2 defaults, changes external CPI wrapper response handling, and adds DummyCpi for integration support. It rewrites related director and integration specs, switches integration support and task wiring to the new CPI implementation, removes CPI v1 integration coverage, and updates CI task coverage settings.

Suggested reviewers

  • mkocher
  • ystros
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 1.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description only states the intent and a CI link, but omits required template sections like tests, release notes, breaking changes, and tags. Expand the PR description to fill the repository template: add context, tests run, release-note text, breaking-change impact, and team/pair tags.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: removing CPI v1 support/testing across the codebase.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-cpi-v1-testing

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb`:
- Around line 38-50: Reject CPI API v1 in the wrapper because `create_vm` and
`attach_disk` now assume v2-style responses and no longer adapt v1 behavior.
Update `check_cpi_api_support` (and any related version gating in
`ExternalCpiResponseWrapper`) so versions below 2 are treated as unsupported, or
otherwise restore the v1 response handling in `create_vm` and `attach_disk` to
match the director/CPI contract.
- Around line 47-50: Remove the redundant attach_disk delegator from
ExternalCpiResponseWrapper so the class only keeps the generic attach_disk
method already defined earlier; this duplicate definition is what triggers
Lint/DuplicateMethods. Update the attach_disk handling in
ExternalCpiResponseWrapper by deleting the stale method body that wraps
`@cpi.attach_disk` and returns cpi_response, and keep the single shared
implementation used for other CPI response wrappers.

In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb`:
- Line 74: The functional spec for UpdateStage is now using CPI API v2, but the
wrapper stub in the affected examples still returns the old single-value
create_vm result, so it no longer validates the v2 response shape. Update the
stubs in the UpdateStage spec to return the v2 create_vm tuple from the wrapper
double, and make sure the expectations in the examples that cover network
settings still exercise the returned value through the relevant helper methods
in UpdateStage.

In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb`:
- Line 15: The create VM specs are still using the old 3-item wrapper shape even
though these contexts opt into CPI API v2. Update the `create_vm_response` in
`create_vm_step_spec` and the deep-copy example responses to use the v2 two-item
`create_vm` response shape, and make sure the examples tied to `CreateVmStep`
and `cpi_api_version` reflect the new API contract consistently.

In `@src/tasks/spec.rake`:
- Around line 88-90: The multitask prerequisites are duplicating the repo-root
unit suite because `spec:unit:release` and `spec:unit:integration_support` both
resolve to the same `rspec`/`parallel_rspec` execution path. Update the
`parallel` task in `spec.rake` so it references a distinct `integration_support`
task chain instead of reusing `spec:unit:release:parallel`, and make the
corresponding adjustment in the related
`spec:unit:release`/`spec:unit:integration_support` task definitions to ensure
each prerequisite runs a different suite.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2b06a7ec-b33e-4f07-9bdb-608037c6e0e3

📥 Commits

Reviewing files that changed from the base of the PR and between 2de4571 and d82b9c1.

📒 Files selected for processing (18)
  • ci/pipeline.yml
  • ci/tasks/test-rake-task.yml
  • src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
  • src/bosh-director/spec/unit/bosh/director/az_cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/compilation_instance_pool_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/missing_vm_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/unresponsive_agent_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/sandbox.rb
  • src/tasks/spec.rake
💤 Files with no reviewable changes (4)
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • ci/pipeline.yml
  • src/spec/integration/unmanaged_persistent_disks_spec.rb

Comment thread src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb Outdated
Comment thread src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
Comment thread src/tasks/spec.rake
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch from d82b9c1 to 8b363e5 Compare June 27, 2026 00:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb`:
- Line 145: The package compile stage spec is still exercising the CPI v1 path
because only Config.preferred_cpi_api_version is changed and cloud.info remains
unstubbed. Update the setup around CloudFactory in package_compile_stage_spec to
stub cloud.info with a v2-compatible response so the factory actually selects
API version 2, and then adjust the create_vm expectations/stubs to use the v2
contract rather than the bare-CID v1 form.

In `@src/spec/integration_support/bin/dummy_cpi`:
- Line 66: The dummy CPI launcher now always instantiates DummyV2, which ignores
any configured API version and can silently run tests against the wrong
contract. Update the bin/dummy_cpi entrypoint to either route non-2 versions
through the existing version-specific CPI selection logic or explicitly fail
fast when the requested API version is not 2; use the version value from the
generated cpi_config/context path so IntegrationSupport::Sandbox overrides are
enforced consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 384fbf29-1edd-4fd6-9650-c2e116a20538

📥 Commits

Reviewing files that changed from the base of the PR and between d82b9c1 and 8b363e5.

📒 Files selected for processing (18)
  • ci/pipeline.yml
  • ci/tasks/test-rake-task.yml
  • src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
  • src/bosh-director/spec/unit/bosh/director/az_cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/compilation_instance_pool_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/missing_vm_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/unresponsive_agent_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/sandbox.rb
  • src/tasks/spec.rake
💤 Files with no reviewable changes (4)
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • ci/pipeline.yml

Comment thread src/spec/integration_support/bin/dummy_cpi Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/spec/integration_support/dummy_cpi.rb`:
- Around line 381-384: Version sorting in the stemcell collection is effectively
doing nothing because the hashes built in `dummy_cpi.rb` use string keys from
YAML, while the final `sort` block in `latest_stemcell` reads `a[:version]` and
`b[:version]`. Update the sort logic to use the actual version key on those
result hashes (or normalize keys before sorting) so the list is ordered
numerically by version rather than by filesystem order. Refer to the
`latest_stemcell` collection pipeline and its final `sort` call when making the
change.
- Around line 141-150: The delete_vm flow in DummyCPI currently derives
agent_pid with vm_cid.to_i, which can turn malformed CIDs into 0 and
accidentally signal the current process group. Update delete_vm to resolve the
VM via `@vm_repo` first, and only call Process.kill in DummyCPI::delete_vm when a
matching record exists and its PID is valid. Keep the existing validation and
rescue behavior, but add a guard so invalid or missing VM CIDs never reach the
kill path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e6c88b5b-aeb5-4bd8-a7e2-63622bd4d49f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b363e5 and 5a3ae43.

📒 Files selected for processing (7)
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/clouds/dummy.rb
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/spec/integration_support/dummy_cpi.rb
  • src/spec/integration_support/sandbox.rb
  • src/spec/integration_support/spec/dummy_cpi_spec.rb
  • src/tasks/spec.rake
💤 Files with no reviewable changes (2)
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/spec/integration_support/clouds/dummy.rb

Comment thread src/spec/integration_support/dummy_cpi.rb
Comment thread src/spec/integration_support/dummy_cpi.rb Outdated
@aramprice aramprice requested review from a team, Ivaylogi98 and ystros and removed request for a team June 27, 2026 01:09
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch from 8a63e7f to 781e6d4 Compare June 27, 2026 01:24
Comment thread src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/spec/integration_support/dummy_cpi.rb`:
- Line 390: The version sort in `latest_stemcell` inside `dummy_cpi.rb` is using
`to_i`, which collapses dotted versions like `1.9` and `1.10` to the same key.
Update the sorting logic to compare the full version string in a way that
preserves dotted semver-style ordering, so `latest_stemcell` no longer depends
on directory order. Use the existing `latest_stemcell`/`sort` path as the place
to adjust the version comparison.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6c7ed8e7-f246-41d0-9908-574d5f2499b7

📥 Commits

Reviewing files that changed from the base of the PR and between 5a3ae43 and 8a63e7f.

📒 Files selected for processing (10)
  • src/bosh-director/lib/bosh/director/cloud_factory.rb
  • src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/jobs/update_stemcell_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/missing_vm_spec.rb
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/dummy_cpi.rb

Comment thread src/spec/integration_support/dummy_cpi.rb Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (1)
src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb (1)

25-25: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Finish the v2 create_vm tuple migration in this spec.

create_vm_response now uses the 2-item v2 shape, but this file still returns the legacy 3-item form at Line 195 and Lines 568-575. That leaves coverage for the removed wrapper contract in place and can hide regressions in CreateVmStep response handling.

Suggested fix
-            allow(cloud_wrapper).to receive(:create_vm).and_return(['', {}, {}])
+            allow(cloud_wrapper).to receive(:create_vm).and_return(['', {}])
...
-              [env_id, {}, {}]
+              [env_id, {}]
...
-              [env_id, {}, {}]
+              [env_id, {}]

Also applies to: 520-520

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb`
at line 25, Finish the v2 create_vm tuple migration in create_vm_step_spec by
replacing the remaining legacy 3-item create_vm_response shapes with the 2-item
v2 form used elsewhere in the file. Update the affected examples in the
CreateVmStep spec so they all return the same [cid, result] tuple shape,
removing any wrapper-style response expectations that still reference the old
contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/spec/integration_support/dummy_cpi.rb`:
- Around line 623-637: The delete-vm wait helpers in DummyCpi spin indefinitely
and need a bounded wait. Update wait_for_delete_vms and
wait_for_unpause_delete_vms to use a timeout when polling the marker files, and
raise or fail with a clear message if the expected file state never changes.
Keep the behavior tied to the existing `@cpi_commands` path markers and the
`@logger` debug calls so the timeout is enforced in both the pause and unpause
flows.
- Around line 358-363: The cleanup helper in kill_process still converts the PID
with agent_pid.to_i, so invalid VM identifiers can become 0 and be signaled
during Sandbox#stop and Sandbox#do_reset. Update kill_process in dummy_cpi to
validate the PID before calling Process.kill, and skip or safely ignore any
non-numeric/zero value so cleanup never signals PID 0 or the current process
group.

In `@src/tasks/spec.rake`:
- Around line 88-94: The unit-test aggregators are scheduling the
integration_support suite twice because `component_dir_names` already yields the
`spec:unit:src` task, which runs the `src/spec` tree including
`spec/integration_support/spec/`. Update the `multitask parallel` and `task
unit` definitions in `spec.rake` to remove the explicit
`spec:unit:integration_support` prerequisite and rely on the component-derived
tasks instead, keeping `spec:unit:release` as the only explicit prerequisite
there.

---

Duplicate comments:
In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb`:
- Line 25: Finish the v2 create_vm tuple migration in create_vm_step_spec by
replacing the remaining legacy 3-item create_vm_response shapes with the 2-item
v2 form used elsewhere in the file. Update the affected examples in the
CreateVmStep spec so they all return the same [cid, result] tuple shape,
removing any wrapper-style response expectations that still reference the old
contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ec83d7d9-b6ba-4cfe-8582-10d62afe03cf

📥 Commits

Reviewing files that changed from the base of the PR and between 8a63e7f and 781e6d4.

📒 Files selected for processing (22)
  • src/bosh-director/lib/bosh/director/cloud_factory.rb
  • src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
  • src/bosh-director/spec/unit/bosh/director/az_cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/compilation_instance_pool_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/jobs/update_stemcell_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/missing_vm_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/unresponsive_agent_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/clouds/dummy.rb
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/spec/integration_support/dummy_cpi.rb
  • src/spec/integration_support/sandbox.rb
  • src/spec/integration_support/spec/dummy_cpi_spec.rb
  • src/tasks/spec.rake
💤 Files with no reviewable changes (5)
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration_support/clouds/dummy.rb

Comment thread src/spec/integration_support/dummy_cpi.rb
Comment thread src/spec/integration_support/dummy_cpi.rb
Comment thread src/tasks/spec.rake
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 27, 2026
@github-project-automation github-project-automation Bot moved this from Waiting for Changes | Open for Contribution to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jun 27, 2026
@aramprice

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/bosh-director/lib/bosh/director/cloud_factory.rb`:
- Around line 61-63: The cloud version detection in CloudFactory is treating
missing or failing cloud.info responses as api_version 2, which can incorrectly
route legacy or broken CPIs into v2-only paths. Update the version parsing logic
around the info_response fetch/rescue in CloudFactory to fail closed instead of
defaulting to 2 when api_version is absent or an error occurs. Keep the existing
wrapper guard behavior intact so unknown CPI versions do not get silently
upgraded, and ensure callers like create_vm cannot proceed with a spoofed v2
version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: db8f7369-e381-4588-a6e3-4e877246e64c

📥 Commits

Reviewing files that changed from the base of the PR and between 8a63e7f and 5b1d26a.

📒 Files selected for processing (24)
  • src/bosh-director/lib/bosh/director/cloud_factory.rb
  • src/bosh-director/lib/clouds/external_cpi_response_wrapper.rb
  • src/bosh-director/spec/unit/bosh/director/az_cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/compilation_instance_pool_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/package_compile_stage_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/jobs/update_stemcell_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/missing_vm_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/unresponsive_agent_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_spec.rb
  • src/spec/integration/cpi_and_agent_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration_support/bin/dummy_cpi
  • src/spec/integration_support/clouds/dummy.rb
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/spec/integration_support/dummy_cpi.rb
  • src/spec/integration_support/invocations_helper.rb
  • src/spec/integration_support/sandbox.rb
  • src/spec/integration_support/spec/dummy_cpi_spec.rb
  • src/tasks/spec.rake
💤 Files with no reviewable changes (5)
  • src/spec/integration/unmanaged_persistent_disks_spec.rb
  • src/spec/integration/cpi_versions/director_cpi_v1_spec.rb
  • src/bosh-director/spec/unit/clouds/external_cpi_response_wrapper_spec.rb
  • src/spec/integration_support/clouds/dummy_v2.rb
  • src/spec/integration_support/clouds/dummy.rb

Comment thread src/bosh-director/lib/bosh/director/cloud_factory.rb Outdated
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Waiting for Changes | Open for Contribution in Foundational Infrastructure Working Group Jun 27, 2026
@aramprice

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb`:
- Line 195: The `CreateVmStep` specs are stubbing `cloud_wrapper.create_vm` with
empty or fake CID values, so they no longer validate the persisted VM CID
contract. Update the affected `create_vm` stubs in `create_vm_step_spec.rb` to
return a real non-empty VM CID string instead of `''` or `env_id`, and keep the
existing return shape so the examples still exercise `CreateVmStep`’s use of
`create_vm_obj[0]`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 23ed0dcc-fc25-42d0-931a-90efb38abb3f

📥 Commits

Reviewing files that changed from the base of the PR and between 5b1d26a and 07095dc.

📒 Files selected for processing (10)
  • src/bosh-director/lib/bosh/director/cloud_factory.rb
  • src/bosh-director/spec/unit/bosh/director/az_cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/cloud_factory_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/compilation_instance_pool_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/stages/update_stage_functional_spec.rb
  • src/bosh-director/spec/unit/bosh/director/deployment_plan/steps/create_vm_step_spec.rb
  • src/bosh-director/spec/unit/bosh/director/jobs/update_stemcell_spec.rb
  • src/bosh-director/spec/unit/bosh/director/problem_handlers/unresponsive_agent_spec.rb
  • src/spec/integration/cpi_and_agent_spec.rb
  • src/spec/integration/vm_delete_spec.rb

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 27, 2026
@github-project-automation github-project-automation Bot moved this from Waiting for Changes | Open for Contribution to Pending Merge | Prioritized in Foundational Infrastructure Working Group Jun 27, 2026
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch from e206297 to 735c4cd Compare June 29, 2026 18:56
@Alphasite Alphasite requested a review from Copilot June 29, 2026 18:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.

Comment thread src/bosh-director/lib/bosh/director/cloud_factory.rb
Comment thread src/spec/integration_support/dummy_cpi.rb
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 29, 2026
@aramprice aramprice changed the title Remove CPI v1 testing Remove CPI v1 Support Jun 29, 2026
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch from 679f7fe to 3199079 Compare June 29, 2026 22:55
@aramprice aramprice requested a review from rkoster June 29, 2026 22:58
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch 2 times, most recently from de45523 to 4578274 Compare June 29, 2026 23:09
Phase 1: Simplify ExternalCpiResponseWrapper by removing v1 branches.
- create_vm: no longer wraps a bare string result in an array; v2+ CPIs
  always return [vm_cid, network_settings] directly
- attach_disk: no longer returns nil for v1; always validates and returns
  the disk hint
- create_stemcell: condense conditional to a single expression

Phase 2: dummy_cpi now unconditionally uses DummyV2. The case statement
that dispatched on the requested api_version is removed; v1 was the only
other branch and it is no longer supported.

Now that CPI v1 is no longer tested, the Dummy/DummyV2 inheritance
hierarchy is unnecessary. Combine them into a single top-level
DummyCpi class with v2 behaviour baked in:

Fail closed when CPI does not report api_version via info; fix v2 test shapes

Phase 3: Remove all v1 test stubs and fixtures.
- Delete spec/integration/cpi_versions/director_cpi_v1_spec.rb entirely
- Remove 'when CPI is v1' context from unmanaged_persistent_disks_spec.rb
- Change sandbox default dummy_cpi_api_version from 1 to 2
- Remove 'when cpi_version is 1' describe block from
  external_cpi_response_wrapper_spec.rb
- Update preferred_cpi_api_version and cpi_api_version stubs from 1 to 2
  in: create_vm_step_spec, cloud_factory_spec, az_cloud_factory_spec,
  package_compile_stage_spec, unresponsive_agent_spec,
  update_stage_functional_spec, compilation_instance_pool_spec
- Fix pre-existing bug in external_cpi_spec.rb: replace undefined
  asset_path() helper call with an explicit File.expand_path relative to
  __dir__, pointing at spec/assets/bin/dummy_cpi.
- Update the mocks to return [vm_cid, network_settings] tuples as a v2
  CPI would, keeping the behaviour consistent with the new wrapper code.
- Merge Dummy and DummyV2 into DummyCpi, drop Bosh::Clouds namespace
@aramprice aramprice force-pushed the remove-cpi-v1-testing branch from 4578274 to e7e5fa7 Compare June 29, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending Merge | Prioritized

Development

Successfully merging this pull request may close these issues.

2 participants